package edu.nf.project.mappers.employeeAndCustomerInformation.convention;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import edu.nf.project.entitys.entity.other.dto.StaffInfoDTO;
import edu.nf.project.entitys.entity.employeeAndCustomerInformation.convention.StaffInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 员工信息 Mapper 接口
 */
@Mapper
public interface StaffInfoMapper extends BaseMapper<StaffInfo> {
    /**
     * 分页查询员工列表（关联用户表）
     */
    @Select("<script>" +
            "SELECT s.*, u.u_name, u.phone " +
            "FROM staff_info s " +
            "LEFT JOIN users u ON s.u_id = u.u_id " +
            "<if test='staffName != null and staffName != \"\"'>" +
            "WHERE s.staff_fullname LIKE CONCAT('%', #{staffName}, '%')" +
            "</if>" +
            "</script>")
    Page<StaffInfoDTO> selectStaffListWithUser(Page<StaffInfoDTO> page, @Param("staffName") String staffName);
} 